<%@ page language="java" import="java.util.*,com.homework.model.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>购物总页</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="css/style.css">

  </head>
  
  <body>
  	<div>
	    <h2>购物总页Shopping.jsp</h2>
	    <form action="payServlet" method="get" >
	    	<span>${username }</span>&nbsp;&nbsp;你好！
	   	 	<input type="submit" value="结账"/>
	    </form>
    </div><br/>
    <hr/>
    <div>
    	<span>我的购物车:</span>
    	<table border="1" >
    		<tr align="center">
    			<th>name</th>
    			<th>number</th>
    		</tr>
    		<c:forEach items="${foodlist }" var="food" varStatus="status">
    			<tr align="center">
    				<td>${food.name }</td>
    				<td>${status.count}</td>
    			</tr>
    		</c:forEach>
    	</table><br/>
    	<hr/>
    	<span>所有商品:</span>
    	<table border="1" >
    		<tr align="center"> 
    			<th>name</th>
    			<th>price</th>
    			<th>operate</th>
    		</tr>
    		<c:forEach items="${foodlist }" var="food">
    			<tr align="center">
    				<td>${food.name }</td>
    				<td>${food.price }</td>
    				<td><input type='button' value='购买' onclick='delCart("+food.getId()+")'/></td>
    			</tr>
    		</c:forEach>
    	</table>
    </div>
  </body>
</html>
